import { ipcRenderer } from "electron";
import { ModalOptions, WindowOptions } from "../../main/windowService";



const windowApi = {
    create: (options: WindowOptions) => ipcRenderer.invoke('window:create', options),
    createModal: (options: ModalOptions) => ipcRenderer.invoke('window:create-modal', options),
    close: (windowId: string) => ipcRenderer.invoke('window:close', windowId),
    minimize: (windowId: string) => ipcRenderer.invoke('window:minimize', windowId),
    maximize: (windowId: string) => ipcRenderer.invoke('window:maximize', windowId),
    reload: (windowId: string) => ipcRenderer.invoke('window:reload', windowId),
    createFloatWindow: (options: WindowOptions) => ipcRenderer.invoke('window:create-float', options),
    floatWindowDragStart: ({ windowId, x, y }) => ipcRenderer.invoke(`float-window-drag-start:${windowId}`, { x, y }),
    floatWindowDragEnd: ({ windowId, x, y }) => ipcRenderer.invoke(`float-window-drag-end:${windowId}`, { x, y }),
    floatWindowDragging: ({ windowId, x, y }) => ipcRenderer.invoke(`float-window-dragging:${windowId}`, { x, y }),
}


export default windowApi;